<template>
	<view class="partner-wrapper">
		<div class="result-wrapper">
			<div class="result" v-if="auditState=='审核拒绝'">审核驳回</div>
			<div class="result" v-else>请耐心等待平台审核……</div>
		</div>
		<div class="list-wrapper">
			<div class="item-wrapper border-bottom">
				<div class="name">支付方式</div>
				<div class="right">
					<div class="name">微信支付</div>
				</div>
			</div>
			<div class="item-wrapper border-bottom">
				<div class="name">支付金额</div>
				<div class="right">
					<div class="name">￥{{userData.price||0}}(应得焕贝额：{{userData.price||0}})</div>
				</div>
			</div>
			<div class="item-wrapper border-bottom" v-if="userData.payTime">
				<div class="name">支付时间</div>
				<div class="right">
					<div class="name">{{userData.payTime||''}}</div>
				</div>
			</div>
			<div class="item-wrapper border-bottom" v-if="auditState=='审核拒绝'">
				<div class="name">驳回理由</div>
				<div class="right">
					<div class="name">{{userData.auditRemark||'无'}}</div>
					<u-button :customStyle="{'background':$lightColor,'color':'#fff' }" @click="applyAgain">重新提审
					</u-button>
				</div>
			</div>
		</div>
	</view>
</template>

<script>
	import {
		userInfo
	} from "@/api/goods"
	import config from "@/config/config.js"
	import {
		getUserWallet,
		CreatePartner,
		TSRateSetting,
		getUserInfo
	} from "@/api/members";
	import storage from "@/utils/storage.js";
	import * as API_Trade from "@/api/trade";
	import payPassword from "@/components/pay-password/pay-password.vue"
	export default {
		components: {
			payPassword
		},
		data() {
			return {
				config,
				partnerType: null, //合伙人类型
				payState: '', //支付状态
				auditState: '', //申请状态
				userData: null,
				auditStatePay: ''
			}
		},
		onLoad(options) {},
		mounted() {
			this.gotoPartnerList()
		},
		async onShow() {
			this.userInfo = this.$options.filters.isLogin();
			if (this.$options.filters.isLogin("auth")) {} else {
				uni.showToast({
					icon: "none",
					duration: 3000,
					title: "请先登录！",
				});
				this.$options.filters.navigateToLogin("redirectTo");
			}
		},
		methods: {
			gotoPartnerList() {
				userInfo().then((res) => {
					let data = res.data.result
					this.partnerType = data.partnerType
					this.userData = data
					if (data.auditState == 'PASS') {
						this.auditState = '审核通过'
						if (data.partnerState == '0') {
							this.auditState = '审核通过'
							this.auditStatePay = '去支付'
						}
					} else if (data.auditState == 'REFUSED') {
						this.auditState = '审核拒绝'
					} else if (data.auditState == 'APPLYING') {
						this.auditState = '审核中'
					}
					if (data.partnerType == 1) {
						uni.setNavigationBarTitle({
							title: '事业合伙人',
						})
					} else if (data.partnerType == 2) {
						uni.setNavigationBarTitle({
							title: '天使合伙人',
						})
					} else if (data.partnerType == 3) {
						uni.setNavigationBarTitle({
							title: '推广员',
						})
					} else if (data.partnerType == 4) {
						uni.setNavigationBarTitle({
							title: '城市合伙人',
						})
					}
				})
			},
			// 重新申请
			applyAgain() {
				console.log(this.partnerType)
				let type = ''
				if (this.partnerType == 2) {
					type = 'ts'
				} else if (this.partnerType == 1) {
					type = 'sy'
				} else if (this.partnerType == 4) {
					type = 'cs'
				}
				uni.navigateTo({
					url: '/pages/partner/partner'
				})
			}
		},
	}
</script>

<style lang="scss">
	.partner-wrapper {
		.result-wrapper {
			margin-top: 24upx;
			padding: 100upx 0 100upx 0;
			background-color: #ffffff;

			.result {
				font-size: 32upx;
				color: #3640ff;
				text-align: center;
			}

			.money {
				margin-top: 12upx;
				display: flex;
				justify-content: center;
				align-items: flex-end;
				color: #ff9838;

				.text {
					font-size: 24upx;
				}

				.money {
					font-size: 48upx;
					font-weight: bold;
				}

				.fee {
					margin-left: 24upx;
					font-size: 24upx;
				}
			}
		}

		.list-wrapper {
			margin-top: 24upx;
			padding: 0 32upx;
			background-color: #ffffff;

			.item-wrapper {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 32upx 0;
				text-align: right;
				color: #9c9c9c;

				.name {
					font-size: #666666;
					font-size: 28upx;
				}

				.phone {
					font-size: 32upx;
					color: #222222;
					margin-bottom: 8upx;
				}

			}

			.border-bottom {
				border-bottom: 2upx solid #f2f2f2;
			}
		}
	}
</style>
